package com.yy.jhl.ui.user.presenter;

import com.google.gson.Gson;
import com.yy.jhl.api.Api;
import com.yy.jhl.api.RxSubscriber;
import com.yy.jhl.bean.LoginInfo;
import com.yy.jhl.ui.user.contract.FindPwdContract;

import okhttp3.FormBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;

import static com.yy.jhl.ui.user.contract.LoginContract.Presenter;

/**
 * Created by Ellis.Li on 2017/8/30.
 */

public class FindPwdPresenter extends FindPwdContract.Presenter {

    @Override
    public void findPwd(String type, String phone,String code, String password, String confirm_password) {
        RequestBody requestBody = new FormBody.Builder()
                .add("type", type)
                .add("phone", phone)
                .add("code", code)
                .add("password", password)
                .add("confirm_password", confirm_password)
                .build();
        mRxManage.addSubscription(Api.getDefault().forgetPwd(requestBody), new RxSubscriber<ResponseBody>(mContext, true) {
            @Override
            protected void _onNext(String result) {
                mView.findSuccess();
            }

            @Override
            protected void _onError(String message) {
                mView.findFail();
            }
        });
    }
}
